home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / typedefs_md.h < prev    next >
C/C++ Source or Header  |  1998-09-15  |  3KB  |  90 lines

  1. /*
  2.  * @(#)typedefs_md.h    1.26 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. /*
  16.  * Win32 dependent type definitions
  17.  */
  18.  
  19. #ifndef _WIN32_TYPEDEF_MD_H_
  20. #define _WIN32_TYPEDEF_MD_H_
  21.  
  22. #include <windows.h>
  23.  
  24. #include "bool.h"
  25.  
  26. typedef unsigned int uint_t;
  27. typedef long int32_t;
  28. typedef unsigned long uint32_t;
  29. typedef __int64    int64_t;
  30. typedef unsigned __int64 uint64_t;
  31.  
  32. /* use these macros when the compiler supports the long long type */
  33.  
  34. #define ll_high(a)    ((long)((a)>>32))
  35. #define ll_low(a)    ((long)(a))
  36. #define int2ll(a)    ((int64_t)(a))
  37. #define ll2int(a)    ((int)(a))
  38. #define ll_add(a, b)    ((a) + (b))
  39. #define ll_and(a, b)    ((a) & (b))
  40. #define ll_div(a, b)    ((a) / (b))
  41. #define ll_mul(a, b)    ((a) * (b))
  42. #define ll_neg(a)    (-(a))
  43. #define ll_not(a)    (~(a))
  44. #define ll_or(a, b)    ((a) | (b))
  45. /* THE FOLLOWING DEFINITION IS NOW A FUNCTION CALL IN ORDER TO WORKAROUND
  46.    OPTIMIZER BUG IN MSVC++ 2.1 (see system_md.c)
  47.    #define ll_shl(a, n)    ((a) << (n)) */
  48. #define ll_shr(a, n)    ((a) >> (n))
  49. #define ll_sub(a, b)    ((a) - (b))
  50. #define ll_ushr(a, n)    ((uint64_t)(a) >> (n))
  51. #define ll_xor(a, b)    ((a) ^ (b))
  52. #define uint2ll(a)    ((uint64_t)(unsigned long)(a))
  53. #define ll_rem(a,b)    ((a) % (b))
  54.  
  55. #define INT_OP(x,op,y)  (((#op[0]=='/')||(#op[0]=='%')) ?                  \
  56.              ( (((x)==0x80000000)&&((y)==-1)) ?            \
  57.                  ((x) op 1) :                              \
  58.                  ((x) op (y))) :                           \
  59.              ((x) op (y)))
  60. #define NAN_CHECK(l,r,x) (!_isnan((l))&&!_isnan((r))) ? (x : 0)
  61. #define IS_NAN(x) _isnan(x)
  62.  
  63. int32_t float2l(float f);
  64. int32_t double2l(double f);
  65. int64_t float2ll(float f);
  66. int64_t double2ll(double f);
  67. #define ll2float(a)    ((float) (a))
  68. #define ll2double(a)    ((double) (a))
  69.  
  70. /* comparison operators */
  71. #define ll_ltz(ll)    ((ll) < 0)
  72. #define ll_gez(ll)    ((ll) >= 0)
  73. #define ll_eqz(a)    ((a) == 0)
  74. #define ll_eq(a, b)    ((a) == (b))
  75. #define ll_ne(a,b)    ((a) != (b))
  76. #define ll_ge(a,b)    ((a) >= (b))
  77. #define ll_le(a,b)    ((a) <= (b))
  78. #define ll_lt(a,b)    ((a) < (b))
  79. #define ll_gt(a,b)    ((a) > (b))
  80.  
  81. #define ll_zero_const    ((int64_t) 0)
  82. #define ll_one_const    ((int64_t) 1)
  83.  
  84. extern void ll2str(int64_t a, char *s, char *limit);
  85. extern int64_t ll_shl(int64_t a, int bits);
  86.  
  87. #include <stdlib.h>    /* For malloc() and free() */
  88.  
  89. #endif /* !_WIN32_TYPEDEF_MD_H_ */
  90.